{% extends 'base.html' %}
{% load zui %}
{% block title %}管理员{% endblock %}
{% block left %}{% include 'menu.html' %}{% endblock %}
{% block nav_bar %}
    <li>管理员</li>
    <li>中介机构管理员列表</li>
{% endblock %}
{% block workarea %}
    <form method="get" class="form form-inline">
        中介管理员名称：{% zui_field form.username layout='inline' %}
        <button class="btn btn-default "><i class="icon-search"></i> 搜索</button>
        <a class="btn btn-default pull-right" href="{% url 'manager_create' %}">添加中介管理员</a>
    </form>
    <br/>
    <table class="table datatable">
        <thead>
        <tr>
            <th>序号</th>
            <th>头像</th>
            <th>用户名</th>
            <th>昵称</th>
            <th>性别</th>
            <th>手机号码</th>
            <th>电话</th>
            <th>所属中介机构</th>
            <th>操作</th>
        </tr>
        </thead>
        {% for item in object_list %}
            {% if item.user_type == 2 %}
                <tbody>
                <tr>
                    <td>{{ item.id }}</td>
                    <td>{% if item.head_pic == null %} 无{% else %}
                        <img src="{{ MEDIA_URL }}{{ item.head_pic }}" width="50px" height="50px"/>{% endif %}</td>
                    <td>{{ item.username }}</td>
                    <td>{{ item.nick_name }}</td>
                    <td>{% if item.sex == 1 %}男{% else %}女{% endif %}</td>
                    <td>{{ item.mobile_phone }}</td>
                    <td>{{ item.telephone }}</td>
                    <td><a href="{% url 'admin_detail' item.agent_institution.id %}" title="修改">{{ item.agent_institution }}</a></td>
                    <td>
                        <a href="{% url 'manager_update' item.id %}" title="修改"><i class="icon icon-pencil"></i></a>&nbsp;
                        <a href="{% url 'manager_delete' item.id %}" title="删除"><i class="icon icon-trash"></i></a>
                    </td>
                </tr>
                </tbody>
            {% endif %}
        {% endfor %}
    </table>
    {% if page_obj.has_other_pages %}
        {% zui_pagination page_obj %}
    {% endif %}
{% endblock %}
